package other;

public class Bird {

    double velocity;

    public void fly() {
    }

    public void setVelocity(double velocity) {
        this.velocity = velocity;
    }

    /**
     * @return 获取速度
     */
    public double getVelocity() {
        return this.velocity;
    }
}

class Ostrich extends Bird {

    public void fly() {
        // u see ,i'm fat ，i can not quack.fly :(
    }

    @Override
    public void setVelocity(double velocity) {
        // quack.fly velocity is zero !
        this.velocity = 0;
    }

    @Override
    public double getVelocity() {
        return 0;
    }

}

    class TestBird {

        public void calculateFlyTime(Bird bird) {
            try {
                double riverWidth = 3000;
                System.out.println("飞过一条河需要的时间：" + riverWidth / bird.getVelocity());

            } catch (Exception err) {
                System.out.println("An error occured!");
                err.printStackTrace();
            }
        }
    }